#include <stdlib.h>
#include <stdio.h>
#include <ctype.h>
#include "{{classname}}.h"


#define MAX_BUFFER_LENGTH 4096
#define intToStr(dst, src) \
    do {\
    char dst[256];\
    snprintf(dst, 256, "%ld", (long int)(src));\
}while(0)

{{#operations}}
{{#operation}}
{{#summary}}
// {{{summary}}}
//
{{/summary}}
{{#notes}}
// {{{notes}}}
//
{{/notes}}
{{#returnType}}{{#returnTypeIsPrimitive}}{{#returnSimpleType}}{{{.}}}*{{/returnSimpleType}}{{^returnSimpleType}}{{#isListContainer}}{{{.}}}_t*{{/isListContainer}}{{#isMapContainer}}{{{.}}}{{/isMapContainer}}{{/returnSimpleType}}{{/returnTypeIsPrimitive}}{{^returnTypeIsPrimitive}}{{{.}}}_t*{{/returnTypeIsPrimitive}}{{/returnType}}{{^returnType}}void{{/returnType}}
{{{classname}}}_{{{operationId}}}(apiClient_t *apiClient{{#allParams}} ,{{#isPrimitiveType}}{{#isNumber}}{{{dataType}}}{{/isNumber}}{{#isLong}}{{{dataType}}}{{/isLong}}{{#isInteger}}{{{dataType}}}{{/isInteger}}{{#isDouble}}{{{dataType}}}{{/isDouble}}{{#isFloat}}{{{dataType}}}{{/isFloat}}{{#isBoolean}}{{dataType}}{{/isBoolean}}{{#isEnum}}{{#isString}}{{{baseName}}}_e{{/isString}}{{/isEnum}}{{^isEnum}}{{#isString}}{{{dataType}}} *{{/isString}}{{/isEnum}}{{#isByteArray}}{{{dataType}}}{{/isByteArray}}{{#isDate}}{{{dataType}}}{{/isDate}}{{#isDateTime}}{{{dataType}}}{{/isDateTime}}{{#isFile}}{{{dataType}}}{{/isFile}}{{#isFreeFormObject}}{{dataType}}_t *{{/isFreeFormObject}}{{/isPrimitiveType}}{{^isPrimitiveType}}{{#isModel}}{{#isEnum}}{{datatypeWithEnum}}_e{{/isEnum}}{{^isEnum}}{{{dataType}}}_t *{{/isEnum}}{{/isModel}}{{^isModel}}{{^isListContainer}}{{#isEnum}}{{datatypeWithEnum}}_e{{/isEnum}}{{/isListContainer}}{{/isModel}}{{#isUuid}}{{dataType}} *{{/isUuid}}{{#isEmail}}{{dataType}}{{/isEmail}}{{/isPrimitiveType}}{{#isContainer}}{{#isListContainer}}{{dataType}}_t *{{/isListContainer}}{{#isMapContainer}}{{dataType}}{{/isMapContainer}}{{/isContainer}} {{{paramName}}}{{/allParams}})
{
    list_t    *localVarQueryParameters = {{#hasQueryParams}}list_create();{{/hasQueryParams}}{{^hasQueryParams}}NULL;{{/hasQueryParams}}
    list_t    *localVarHeaderParameters = {{#hasHeaderParams}}list_create();{{/hasHeaderParams}}{{^hasHeaderParams}}NULL;{{/hasHeaderParams}}
    list_t    *localVarFormParameters = {{#hasFormParams}}list_create();{{/hasFormParams}}{{^hasFormParams}}NULL;{{/hasFormParams}}
    list_t *localVarHeaderType = {{#hasProduces}}list_create();{{/hasProduces}}{{^hasProduces}}NULL;{{/hasProduces}}
    list_t *localVarContentType = {{#hasConsumes}}list_create();{{/hasConsumes}}{{^hasConsumes}}NULL;{{/hasConsumes}}
    char      *localVarBodyParameters = NULL;

    // create the path
    long sizeOfPath = strlen("{{{path}}}")+1;
    char *localVarPath = malloc(sizeOfPath);
    snprintf(localVarPath, sizeOfPath, "{{{path}}}");

    {{#pathParams}}

    // Path Params
    long sizeOfPathParams_{{{paramName}}} = {{#pathParams}}{{#isLong}}sizeof({{paramName}})+3{{/isLong}}{{#isString}}strlen({{paramName}})+3{{/isString}}{{#hasMore}} + {{/hasMore}}{{/pathParams}} + strlen("{ {{paramName}} }");
    {{#isNumeric}}
    if({{paramName}} == 0){
        goto end;
    }
    char* localVarToReplace_{{paramName}} = malloc(sizeOfPathParams_{{paramName}});
    snprintf(localVarToReplace_{{paramName}}, sizeOfPathParams_{{paramName}}, "{%s}", "{{paramName}}");

    char localVarBuff_{{paramName}}[256];
    intToStr(localVarBuff_{{paramName}}, {{paramName}});

    localVarPath = strReplace(localVarPath, localVarToReplace_{{paramName}}, localVarBuff_{{paramName}});

    {{/isNumeric}}
    {{#isInteger}}
    if({{paramName}} == 0){
        goto end;
    }
    char* localVarToReplace_{{paramName}} = malloc(sizeOfPathParams_{{paramName}});
    snprintf(localVarToReplace_{{paramName}}, sizeOfPathParams_{{paramName}}, "{%s}", "{{paramName}}");

    char localVarBuff_{{paramName}}[256];
    intToStr(localVarBuff_{{paramName}}, {{paramName}});

    localVarPath = strReplace(localVarPath, localVarToReplace_{{paramName}}, localVarBuff_{{paramName}});

    {{/isInteger}}
    {{#isFloat}}
    if({{paramName}} == 0){
        goto end;
    }
    char* localVarToReplace_{{paramName}} = malloc(sizeOfPathParams_{{paramName}});
    snprintf(localVarToReplace_{{paramName}}, sizeOfPathParams_{{paramName}}, "{%s}", "{{paramName}}");

    char localVarBuff_{{paramName}}[256];
    intToStr(localVarBuff_{{paramName}}, {{paramName}});

    localVarPath = strReplace(localVarPath, localVarToReplace_{{paramName}}, localVarBuff_{{paramName}});

    {{/isFloat}}
    {{#isLong}}
    if({{paramName}} == 0){
        goto end;
    }
    char* localVarToReplace_{{paramName}} = malloc(sizeOfPathParams_{{paramName}});
    snprintf(localVarToReplace_{{paramName}}, sizeOfPathParams_{{paramName}}, "{%s}", "{{paramName}}");

    char localVarBuff_{{paramName}}[256];
    intToStr(localVarBuff_{{paramName}}, {{paramName}});

    localVarPath = strReplace(localVarPath, localVarToReplace_{{paramName}}, localVarBuff_{{paramName}});

    {{/isLong}}
    {{#isString}}
    if({{paramName}} == NULL) {
        goto end;
    }
    char* localVarToReplace_{{paramName}} = malloc(sizeOfPathParams_{{paramName}});
    sprintf(localVarToReplace_{{paramName}}, "{%s}", "{{paramName}}");

    localVarPath = strReplace(localVarPath, localVarToReplace_{{paramName}}, {{paramName}});
    {{/isString}}
    {{#isUuid}}
    if({{paramName}} == NULL) {
        goto end;
    }
    char* localVarToReplace_{{paramName}} = malloc(sizeOfPathParams_{{paramName}});
    sprintf(localVarToReplace_{{paramName}}, "{%s}", "{{paramName}}");

    localVarPath = strReplace(localVarPath, localVarToReplace_{{paramName}}, {{paramName}});
    {{/isUuid}}
    {{/pathParams}}


    {{#headerParams}}

    // header parameters
    char *keyHeader_{{{paramName}}};
    {{#isPrimitiveType}}{{#isNumber}}{{{dataType}}}{{/isNumber}}{{#isLong}}{{{dataType}}}{{/isLong}}{{#isInteger}}{{{dataType}}}{{/isInteger}}{{#isDouble}}{{{dataType}}}{{/isDouble}}{{#isFloat}}{{{dataType}}}{{/isFloat}}{{#isBoolean}}{{dataType}}{{/isBoolean}}{{#isEnum}}{{#isString}}{{{baseName}}}_e{{/isString}}{{/isEnum}}{{^isEnum}}{{#isString}}{{{dataType}}} *{{/isString}}{{/isEnum}}{{#isByteArray}}{{{dataType}}}{{/isByteArray}}{{#isDate}}{{{dataType}}}{{/isDate}}{{#isDateTime}}{{{dataType}}}{{/isDateTime}}{{#isFile}}{{{dataType}}}{{/isFile}}{{/isPrimitiveType}}{{^isPrimitiveType}}{{#isModel}}{{#isEnum}}{{datatypeWithEnum}}_e{{/isEnum}}{{^isEnum}}{{{dataType}}}_t *{{/isEnum}}{{/isModel}}{{^isModel}}{{#isEnum}}{{datatypeWithEnum}}_e{{/isEnum}}{{/isModel}}{{#isUuid}}{{dataType}} *{{/isUuid}}{{#isEmail}}{{dataType}}{{/isEmail}}{{/isPrimitiveType}} valueHeader_{{{paramName}}};
    keyValuePair_t *keyPairHeader_{{paramName}} = 0;
    if ({{paramName}}) {
        keyHeader_{{{paramName}}} = strdup("{{{paramName}}}");
        valueHeader_{{{paramName}}} = {{#isString}}{{^isEnum}}strdup({{/isEnum}}{{/isString}}({{{paramName}}}){{#isString}}{{^isEnum}}){{/isEnum}}{{/isString}};
        keyPairHeader_{{paramName}} = keyValuePair_create(keyHeader_{{{paramName}}}, {{#isEnum}}(void *){{/isEnum}}{{^isString}}&{{/isString}}valueHeader_{{{paramName}}});
        list_addElement(localVarHeaderParameters,keyPairHeader_{{paramName}});
    }

    {{/headerParams}}
    {{#queryParams}}

    // query parameters
    {{^isListContainer}}
    char *keyQuery_{{{paramName}}};
    {{#isPrimitiveType}}{{#isNumber}}{{{dataType}}}{{/isNumber}}{{#isLong}}{{{dataType}}}{{/isLong}}{{#isInteger}}{{{dataType}}}{{/isInteger}}{{#isDouble}}{{{dataType}}}{{/isDouble}}{{#isFloat}}{{{dataType}}}{{/isFloat}}{{#isBoolean}}{{{dataType}}}{{/isBoolean}}{{#isEnum}}{{#isString}}{{{baseName}}}_e{{/isString}}{{/isEnum}}{{^isEnum}}{{#isString}}{{{dataType}}} *{{/isString}}{{/isEnum}}{{#isByteArray}}{{{dataType}}}{{/isByteArray}}{{#isDate}}{{{dataType}}}{{/isDate}}{{#isDateTime}}{{{dataType}}}{{/isDateTime}}{{#isFile}}{{{dataType}}}{{/isFile}}{{/isPrimitiveType}}{{^isPrimitiveType}}{{#isModel}}{{#isEnum}}{{datatypeWithEnum}}_e{{/isEnum}}{{^isEnum}}{{{dataType}}}_t *{{/isEnum}}{{/isModel}}{{^isModel}}{{#isEnum}}{{datatypeWithEnum}}_e{{/isEnum}}{{/isModel}}{{#isUuid}}{{dataType}} *{{/isUuid}}{{#isEmail}}{{dataType}}{{/isEmail}}{{/isPrimitiveType}} valueQuery_{{{paramName}}};
    keyValuePair_t *keyPairQuery_{{paramName}} = 0;
    {{/isListContainer}}
    if ({{paramName}})
    {
        {{#isListContainer}}
        list_addElement(localVarQueryParameters,{{paramName}});
        {{/isListContainer}}
        {{^isListContainer}}
        keyQuery_{{{paramName}}} = strdup("{{{baseName}}}");
        valueQuery_{{{paramName}}} = {{#isString}}{{^isEnum}}strdup({{/isEnum}}{{/isString}}({{{paramName}}}){{#isString}}{{^isEnum}}){{/isEnum}}{{/isString}};
        keyPairQuery_{{paramName}} = keyValuePair_create(keyQuery_{{{paramName}}}, {{#isEnum}}(void *){{/isEnum}}{{^isString}}&{{/isString}}valueQuery_{{{paramName}}});
        list_addElement(localVarQueryParameters,keyPairQuery_{{paramName}});
        {{/isListContainer}}
    }
    {{/queryParams}}
    {{#formParams}}

    // form parameters
    {{#isFile}}
    char *keyForm_{{paramName}};
    {{{dataType}}} valueForm_{{paramName}};
    keyValuePair_t *keyPairForm_{{paramName}} = 0;
    {{/isFile}}
    {{^isFile}}
    char *keyForm_{{paramName}};
    {{#isPrimitiveType}}{{#isNumber}}{{{dataType}}}{{/isNumber}}{{#isLong}}{{{dataType}}}{{/isLong}}{{#isInteger}}{{{dataType}}}{{/isInteger}}{{#isDouble}}{{{dataType}}}{{/isDouble}}{{#isFloat}}{{{dataType}}}{{/isFloat}}{{#isBoolean}}{{dataType}}{{/isBoolean}}{{#isEnum}}{{#isString}}{{{baseName}}}_e{{/isString}}{{/isEnum}}{{^isEnum}}{{#isString}}{{{dataType}}} *{{/isString}}{{/isEnum}}{{#isByteArray}}{{{dataType}}}{{/isByteArray}}{{#isDate}}{{{dataType}}}{{/isDate}}{{#isDateTime}}{{{dataType}}}{{/isDateTime}}{{#isFile}}{{{dataType}}}{{/isFile}}{{/isPrimitiveType}}{{^isPrimitiveType}}{{#isModel}}{{#isEnum}}{{datatypeWithEnum}}_e{{/isEnum}}{{^isEnum}}{{{dataType}}}_t *{{/isEnum}}{{/isModel}}{{^isModel}}{{#isEnum}}{{datatypeWithEnum}}_e{{/isEnum}}{{/isModel}}{{#isUuid}}{{dataType}} *{{/isUuid}}{{#isEmail}}{{dataType}}{{/isEmail}}{{/isPrimitiveType}} valueForm_{{paramName}};
    keyValuePair_t *keyPairForm_{{paramName}} = 0;
    {{/isFile}}
    if ({{paramName}} != NULL)
    {
        {{#isFile}}
        keyForm_{{paramName}} = strdup("{{{paramName}}}");
        valueForm_{{paramName}} = {{paramName}};
        keyPairForm_{{paramName}} = keyValuePair_create(keyForm_{{paramName}}, &valueForm_{{paramName}});
        list_addElement(localVarFormParameters,keyPairForm_{{paramName}}); //file adding
        {{/isFile}}
        {{^isFile}}
        keyForm_{{paramName}} = strdup("{{{paramName}}}");
        valueForm_{{paramName}} = {{#isString}}{{^isEnum}}strdup({{/isEnum}}{{/isString}}({{{paramName}}}){{#isString}}{{^isEnum}}){{/isEnum}}{{/isString}};
        keyPairForm_{{paramName}} = keyValuePair_create(keyForm_{{paramName}},{{#isString}}{{#isEnum}}(void *){{/isEnum}}{{/isString}}{{^isString}}&{{/isString}}valueForm_{{paramName}});
        list_addElement(localVarFormParameters,keyPairForm_{{paramName}});
        {{/isFile}}
    }
    {{/formParams}}
    {{#bodyParam}}

    // Body Param
    {{#isListContainer}}
    //notstring
    cJSON *localVar_{{paramName}};
    cJSON *localVarItemJSON_{{paramName}};
    cJSON *localVarSingleItemJSON_{{paramName}};
    if ({{paramName}} != NULL)
    {
        localVarItemJSON_{{paramName}} = cJSON_CreateObject();
        localVarSingleItemJSON_{{paramName}} = cJSON_AddArrayToObject(localVarItemJSON_{{paramName}}, "{{paramName}}");
        if (localVarSingleItemJSON_{{paramName}} == NULL)
        {
            // nonprimitive container

            goto end;
        }
    }

    listEntry_t *{{paramName}}BodyListEntry;
    list_ForEach({{paramName}}BodyListEntry, {{paramName}})
    {
        localVar_{{paramName}} = {{#items}}{{complexType}}{{/items}}_convertToJSON({{paramName}}BodyListEntry->data);
        if(localVar_{{paramName}} == NULL)
        {
            goto end;
        }
        cJSON_AddItemToArray(localVarSingleItemJSON_{{paramName}}, localVar_{{paramName}});
        localVarBodyParameters = cJSON_Print(localVarItemJSON_{{paramName}});
    }
    {{/isListContainer}}
    {{^isListContainer}}
    cJSON *localVarSingleItemJSON_{{paramName}};
    if ({{paramName}} != NULL)
    {
        //string
        localVarSingleItemJSON_{{paramName}} = {{dataType}}_convertToJSON({{paramName}});
        localVarBodyParameters = cJSON_Print(localVarSingleItemJSON_{{paramName}});
    }
    {{/isListContainer}}
    {{/bodyParam}}
    {{#produces}}
    list_addElement(localVarHeaderType,"{{{mediaType}}}"); //produces
    {{/produces}}
    {{#consumes}}
    list_addElement(localVarContentType,"{{{mediaType}}}"); //consumes
    {{/consumes}}
    apiClient_invoke(apiClient,
                    localVarPath,
                    localVarQueryParameters,
                    localVarHeaderParameters,
                    localVarFormParameters,
                    localVarHeaderType,
                    localVarContentType,
                    localVarBodyParameters,
                    "{{{httpMethod}}}");

    {{#responses}}
    if (apiClient->response_code == {{code}}) {
        printf("%s\n","{{message}}");
    }
    {{/responses}}
    {{#returnType}}
    {{#returnTypeIsPrimitive}}
    {{#returnSimpleType}}
    //primitive reutrn type simple
    {{returnType}}* elementToReturn =  strdup(({{returnType}}*)apiClient->dataReceived);

    {{/returnSimpleType}}
    {{^returnSimpleType}}
    //primitive reutrn type not simple
    cJSON *{{paramName}}localVarJSON = cJSON_Parse(apiClient->dataReceived);
    cJSON *{{{paramName}}}VarJSON;
    list_t *elementToReturn = list_create();
    cJSON_ArrayForEach({{{paramName}}}VarJSON, {{paramName}}localVarJSON){
        keyValuePair_t *keyPair = keyValuePair_create(strdup({{{paramName}}}VarJSON->string), cJSON_Print({{{paramName}}}VarJSON));
        list_addElement(elementToReturn, keyPair);
    }
    cJSON_Delete({{paramName}}localVarJSON);

    {{/returnSimpleType}}
    {{/returnTypeIsPrimitive}}
    {{^returnTypeIsPrimitive}}
    {{#returnContainer}}
    cJSON *{{classname}}localVarJSON = cJSON_Parse(apiClient->dataReceived);
    if(!cJSON_IsArray({{classname}}localVarJSON)) {
        return 0;//nonprimitive container
    }
    list_t *elementToReturn = list_create();
    cJSON *{{{paramName}}}VarJSON;
    cJSON_ArrayForEach({{{paramName}}}VarJSON, {{classname}}localVarJSON)
    {
        if(!cJSON_IsObject({{{paramName}}}VarJSON))
        {
           // return 0;
        }
        char *localVarJSONToChar = cJSON_Print({{{paramName}}}VarJSON);
        list_addElement(elementToReturn , localVarJSONToChar);
    }

    cJSON_Delete( {{classname}}localVarJSON);
    cJSON_Delete( {{{paramName}}}VarJSON);
    {{/returnContainer}}
    {{^returnContainer}}
    //nonprimitive not container
    cJSON *{{classname}}localVarJSON = cJSON_Parse(apiClient->dataReceived);
    {{{returnBaseType}}}_t *elementToReturn = {{{returnBaseType}}}_parseFromJSON({{classname}}localVarJSON);
    cJSON_Delete({{classname}}localVarJSON);
    if(elementToReturn == NULL) {
        // return 0;
    }

    {{/returnContainer}}
    //return type
    {{/returnTypeIsPrimitive}}
    if (apiClient->dataReceived) {
        free(apiClient->dataReceived);
    }
    {{#hasQueryParams}}list_free(localVarQueryParameters);{{/hasQueryParams}}
    {{#hasHeaderParams}}list_free(localVarHeaderParameters);{{/hasHeaderParams}}
    {{#hasFormParams}}list_free(localVarFormParameters);{{/hasFormParams}}
    {{#hasProduces}}list_free(localVarHeaderType);{{/hasProduces}}
    {{#hasConsumes}}list_free(localVarContentType);{{/hasConsumes}}
    free(localVarPath);
    {{#pathParams}}
    free(localVarToReplace_{{paramName}});
    {{/pathParams}}
    {{#headerParams}}
    {{#isString}}
    free(keyHeader_{{{paramName}}});
    free(valueHeader_{{{paramName}}});
    {{/isString}}
    {{^isString}}
    free(keyHeader_{{{paramName}}});
    {{/isString}}
    free(keyPairHeader_{{paramName}});
    {{/headerParams}}
    {{#bodyParams}}
    {{#isListContainer}}
    cJSON_Delete(localVarItemJSON_{{paramName}});
    cJSON_Delete(localVarSingleItemJSON_{{paramName}});
    cJSON_Delete(localVar_{{paramName}});
    free(localVarBodyParameters);
    {{/isListContainer}}
    {{^isListContainer}}
    cJSON_Delete(localVarSingleItemJSON_{{paramName}});
    free(localVarBodyParameters);
    {{/isListContainer}}
    {{/bodyParams}}
    {{#queryParams}}
    {{^isListContainer}}
    {{#isString}}
    free(keyQuery_{{{paramName}}});
    free(valueQuery_{{{paramName}}});
    keyValuePair_free(keyPairQuery_{{{paramName}}});
    {{/isString}}
    {{^isString}}
    free(keyQuery_{{{paramName}}});
    keyValuePair_free(keyPairQuery_{{{paramName}}});
    {{/isString}}
    {{/isListContainer}}
    {{/queryParams}}
    {{#formParams}}
    {{#isFile}}
    free(keyForm_{{{paramName}}});
//    free(fileVar_{{paramName}}->data);
//    free(fileVar_{{paramName}});
    free(keyPairForm_{{paramName}});
    {{/isFile}}
    {{^isFile}}
    {{#isString}}
    free(keyForm_{{{paramName}}});
    free(valueForm_{{{paramName}}});
    free(keyPairForm_{{paramName}});
    {{/isString}}
    {{^isString}}
    free(keyForm_{{{paramName}}});
    free(keyPairForm_{{paramName}});
    {{/isString}}
    {{/isFile}}
    {{/formParams}}
    return elementToReturn;
end:
    return NULL;
    {{/returnType}}
    {{^returnType}}
    //No return type
end:
    if (apiClient->dataReceived) {
        free(apiClient->dataReceived);
    }
    {{#hasQueryParams}}list_free(localVarQueryParameters);{{/hasQueryParams}}
    {{#hasHeaderParams}}list_free(localVarHeaderParameters);{{/hasHeaderParams}}
    {{#hasFormParams}}list_free(localVarFormParameters);{{/hasFormParams}}
    {{#hasProduces}}list_free(localVarHeaderType);{{/hasProduces}}
    {{#hasConsumes}}list_free(localVarContentType);{{/hasConsumes}}
    free(localVarPath);
    {{#pathParams}}
    free(localVarToReplace_{{paramName}});
    {{/pathParams}}
    {{#headerParams}}
    {{#isString}}
    free(keyHeader_{{{paramName}}});
    free(valueHeader_{{{paramName}}});
    {{/isString}}
    {{^isString}}
    free(keyHeader_{{{paramName}}});
    {{/isString}}
    free(keyPairHeader_{{paramName}});
    {{/headerParams}}
    {{#bodyParams}}
    {{#isListContainer}}
    cJSON_Delete(localVarItemJSON_{{paramName}});
    cJSON_Delete(localVarSingleItemJSON_{{paramName}});
    cJSON_Delete(localVar_{{paramName}});
    free(localVarBodyParameters);
    {{/isListContainer}}
    {{^isListContainer}}
    cJSON_Delete(localVarSingleItemJSON_{{paramName}});
    free(localVarBodyParameters);
    {{/isListContainer}}
    {{/bodyParams}}
    {{#queryParams}}
    {{^isListContainer}}
    {{#isString}}
    free(keyQuery_{{{paramName}}});
    free(valueQuery_{{{paramName}}});
    keyValuePair_free(keyPairQuery_{{{paramName}}});
    {{/isString}}
    {{#isString}}
    free(keyQuery_{{{paramName}}});
    keyValuePair_free(keyPairQuery_{{{paramName}}});
    {{/isString}}
    {{/isListContainer}}
    {{/queryParams}}
    {{#formParams}}
    {{#isFile}}
    free(keyForm_{{{paramName}}});
//    free(fileVar_{{paramName}}->data);
//    free(fileVar_{{paramName}});
    {{/isFile}}
    {{^isFile}}
    {{#isString}}
    free(keyForm_{{{paramName}}});
    free(valueForm_{{{paramName}}});
    keyValuePair_free(keyPairForm_{{{paramName}}});
    {{/isString}}
    {{^isString}}
    free(keyForm_{{{paramName}}});
    free(keyPairForm_{{paramName}});
    {{/isString}}
    {{/isFile}}
    {{/formParams}}
    {{/returnType}}

}

{{/operation}}
{{/operations}}
